/**
 * 
 */

package reporting;
import java.util.*;

import static util.ConstantCollection.*;

/**
 * @author 
 *
 */

class Message{
	
	private String id;
	private Date dateTime;
	private String duration;
	private String messageType;
	private int status;
    private String header;
    private String headerForDesc;
    private String description;
    private String cpBriefResult;
    private String cpFull;
    private String addInfo;
    private String signature;
    private String screenshot;
    private String screenshotTitle;
    private String bugTemplate;
    private String expected;
	private String actual;
    private String errorId;
    private HashMap formattedMsgDict;
    
    /**
	 * @return the formattedMsgDict
	 */
	public HashMap getFormattedMsgDict() {
		return formattedMsgDict;
	}

	/**
	 * @param formattedMsgDict the formattedMsgDict to set
	 */
	private void setFormattedMsgDict(HashMap formattedMsgDict) {
		this.formattedMsgDict = formattedMsgDict;
	}

	public Message(){
    	dateTime = new Date();
    	//duration = dateTime - ReportEngine.lastMsgDate;
    		
    }
        
    public void setId(String id){
        if(this.id == null){
        	 this.id = id;
        }else{
            System.out.print("Importance is forbidden assign! Old Id =" +  this.id + " New Id=" + id);
        }
    }
    
    public String getId(){
        return id;
    }
   
    /**
	 * @return the dateTime
	 */
	public Date getDateTime() {
		return dateTime;
	}

    /**
	 * @return the duration
	 */
	public String getDuration() {
		return duration;
	}

	/**
	 * @param messageType the messageType to set
	 */
	public void setMessageType(String messageType) {
        if(this.messageType == null){
        	Collection<String> colMsgType = new ArrayList<String>();
        	colMsgType.add("actionstart");
        	colMsgType.add("actionend");
        	colMsgType.add("sectionstart");
        	colMsgType.add("sectionend");
        	colMsgType.add("stepstart");
        	colMsgType.add("stepend");
        	colMsgType.add("uidriver");
        	colMsgType.add("event");
        	colMsgType.add("debug");
        	colMsgType.add("cp");
        	
        	if (colMsgType.contains(messageType))
        		this.messageType = messageType;
        	else
        		this.messageType = "event"; 
        	
        }
        else{

        	System.out.print("Importance is forbidden assign! Old MessageType =" +  this.messageType + " New MessageType=" + messageType + "\n");
        }
	}
	
	/**
	 * @return the messageType
	 */
	public String getMessageType() {
		return messageType;
	}
	
    public void setStatus(int status){
        if(status  >= 0 && status  <= 7 )
        	this.status = status;
        else{
        	this.status = STATUS_WARNING;
            //System.out.print("Status is unknowing");
        }
}

    /**
     * @return
     */
    public int getStatus(){
        return status;
    }

    public void setHeader(String header){
        if(this.header == null){
            this.header = header;
        }else{
        	//TODO Add waring according to new reporting
            //System.out.print("There is no rights!");
        }
    }

    public String getHeader(){
    	return header;
    }

    public void setHeaderForDesc(String headerForDesc){
        if(this.headerForDesc == null){
        	this.headerForDesc = headerForDesc;
        }else{
        	//TODO 
        	//System.out.print("There is no rights!");
        }        
    }

    public String getHeaderForDesc(){
        return headerForDesc;       
    }

    public void setDescription(String description){
        if(this.description == null){
            this.description = description;
        }else{
        	//TODO
            //System.out.print("There is no rights!");
        }
    }

    public String getDescription(){
        return description;
    }

    public void setCpBriefResult(String cpBriefResult){
        if(this.cpBriefResult == null){
            this.cpBriefResult = cpBriefResult;
        }else{
        	//TODO
            //System.out.print("There is no rights!");
        } 
    }

    public String getCpBriefResult(){
        return cpBriefResult;
    }

    public void setCpFull(String cpFull){
        if(this.cpFull == null){
            this.cpFull = cpFull;
        }else{
        	//TODO
            //System.out.print("There is no rights!");
        } 
    }

    public String getCpFull(){
        return cpFull;
    }

    public void setAddInfo(String addInfo){
        if(this.addInfo == null){
            this.addInfo = addInfo;
        }else{
        	//TODO
            //System.out.print("There is no rights!");
        } 
    }

    public String getAddInfo(){
        return addInfo;
    }

    public void setSignature(String signature){
        if(this.signature == null){
            this.signature = signature;
        }else{
        	//TODO
            //System.out.print("There is no rights!");
        } 
    }

    public String getSignature(){
        return signature;
    }

    public void setScreenshot(String screenshot){
        if(this.screenshot == null){
            this.screenshot = screenshot;
        }else{
        	//TODO
            //System.out.print("There is no rights!");
        } 
    }

    public String getScreenshot(){
        return screenshot;
    }

    public void setScreenshotTitle(String screenshotTitle){
        if(this.screenshotTitle == null){
            this.screenshotTitle = screenshotTitle;
        }else{
        	//TODO
            //System.out.print("There is no rights!");
        } 
    }

    public String getScreenshotTitle(){
        return screenshotTitle;
    }

   
    public void setBugTemplate(String bugTemplate){
        if(this.bugTemplate == null){
            this.bugTemplate = bugTemplate;
        }else{
        	//TODO
            //System.out.print("There is no rights!");
        } 
    }

    public String getBugTemplate(){
        return bugTemplate;
    }

    public void setExpected(String expected){
        if(this.expected == null){
            this.expected = expected;
        }else{
        	//TODO
            //System.out.print("There is no rights!");
        } 
    }

    public String getExpected(){
        return expected;
    }

    public void setActual(String actual){
        if(this.actual == null){
            this.actual = actual;
        }else{
        	//TODO
            //System.out.print("There is no rights!");
        } 
    }

    public String getActual(){
        return actual;
    }

    public void setErrorId(String erroId){
    	if ( this.errorId == null ){
            this.errorId = erroId;}
    	else{
        	//TODO
            //System.out.print("There is no rights!");
        } 
    }

    public String getErrorId(){
        return errorId;
    }
    
    private void addFormattedMsgToDict(String typeReport, String formattedMsg){
    	//TODO Filling at the end development framework for much better performance
    }
    private void getFormattedMsgFromDict(String typeReport){
    	//TODO Filling at the end development framework for much better performance
    }

}